#ifndef SQLPropertyExpr_HEADER_H
#define SQLPropertyExpr_HEADER_H


#include <string>

#include "../SQLExpr.h"
#include "../SQLExprImpl.h"
#include "../SQLName.h"
#include "../SQLObject.h"
#include "../statement/SQLTableSource.h"
class SQLASTVisitor;

class SQLPropertyExpr : virtual public SQLExprImpl, virtual public SQLName
{
private:
  SQLExpr_ptr owner;
  string_ptr name;
  SQLObject_ptr resolvedOwnerObject;
  SQLObject_ptr resolvedColumn;
  long nameHashCod64;

public:
  long hashCode64_;
  static string_ptr class_;

  SQLPropertyExpr(SQLExpr_ptr owner, string_ptr name);
  SQLPropertyExpr(string_ptr owner, string_ptr name);
  SQLPropertyExpr();
  ~SQLPropertyExpr();
  SQLPropertyExpr(SQLExpr_ptr owner, string_ptr name, long nameHashCod64) ;
  SHAREDOBJECT(SQLPropertyExpr);

  string_ptr getSimleName();

  SQLExpr_ptr getOwner();

  void setOwner(SQLExpr_ptr owner);
  void setOwner(string_ptr owner);

  string_ptr getName();

  void setName(string_ptr name);

  void output(std::stringstream* buf);
  // int hashCode();
  // BOOL_ptr equals(Object obj);
  string_ptr getSimpleName();

  // SQLPropertyExpr *clone();
  virtual SQLObject_ptr clone();
  SQLTableSource_ptr getResolvedTableSource();

  long nameHashCode64();

  long hashCode64();
  string_ptr getOwnerName();

  bool containsAttribute(string_ptr name){};
  void addBeforeComment(string_list_ptr comments){};
  string_list_ptr getAfterCommentsDirect(){};
  string_list_ptr getBeforeCommentsDirect(){};
  void addAfterComment(string_ptr comment){};
  void addAfterComment(string_list_ptr comments){};
  bool hasBeforeComment(){};
  bool hasAfterComment(){};
  BOOL_ptr nameEquals(string_ptr name);

  void computeHashCode64();
  string_ptr getOwnernName();
  string_ptr normalizedName();
  
  void setResolvedTableSource(SQLTableSource_ptr resolvedTableSource) {
    this->resolvedOwnerObject = resolvedTableSource;
  }
  void setResolvedColumn(SQLSelectItem_ptr resolvedColumn);
  void setResolvedColumn(SQLColumnDefinition_ptr resolvedColumn);
  void setResolvedOwnerObject(SQLObject_ptr resolvedOwnerObject);
  SQLObject_ptr getResolvedOwnerObject() ;
  SQLCreateProcedureStatement_ptr getResolvedProcudure();
  SQLPropertyExpr_ptr simplify();
protected:
  void accept0(SQLASTVisitor_ptr visitor);
};
// typedef boost::shared_ptr<SQLPropertyExpr> SQLPropertyExpr_ptr;
#endif
